package study04;
import java.util.Random;
import java.util.Scanner;

/**
* @author GZQ
* @Date 2023/11/23
 */

public class Test2 {
    public static void main(String[] args) {
        String a = "";
        // 生成1-3的随机数
        Random random = new Random();
        int number = random.nextInt(3) + 1;
        if (number == 1){
            a = "剪刀";
        }if (number == 2){
            a = "石头";
        }if (number == 3){
            a = "布";
        }
        int i = 1; // 统计次数
        while (i <= 5){
            System.out.println("请输入：剪刀->石头->布");
            System.out.println("第" + i + "局");
            Scanner input = new Scanner(System.in);
            String player = input.next();
            System.out.println(player);
            System.out.println("电脑本次出的是：" + a);
            if(player.equals(a)){
                System.out.println("打平了");
            }
            i++;
        }
    }
}
